package 线程的创建;
//实现Runnable接口创建多线程
public class text2 {
    public static void main(String[] args) {
        //创建线程对象
        MyRunnable myRunnable = new MyRunnable();
        //创建Thread对象，并传入Runnable对象
        Thread thread = new Thread(myRunnable);
        thread.start();
        //在主方法中执行其他任务
        while(true){
            System.out.println("主线程正在运行");
        }
    }
}
class MyRunnable implements Runnable {
    public void run() {
        while(true){
            System.out.println("线程正在运行");
        }
    }
}
